﻿using System;
using TweetSharp;

namespace PocketBlueBird.ViewModels
{
    public class ComposeNewTweetViewModel : BaseViewModel
    {
        private TwitterService _service;

        public ComposeNewTweetViewModel()
        {
            if (IsAuthorized)
            {
                _service = new TwitterService(
                    _consumerKey,
                    _consumerSecret,
                    App.AccessToken.Token,
                    App.AccessToken.TokenSecret);
            }
        }

        public void SendTweet(string status, Action<TwitterStatus, TwitterResponse> action)
        {
            _service.SendTweet(status, (tweet, response) =>
            {
                action(tweet, response);
            });
        }
    }
}
